﻿@model List<User>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户信息</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>


    <!--展示数据的主窗口-->
    <div class="container mt-5">
        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <div class="card-header bg-primary text-white">
                        用户信息列表
                        <form asp-action="SltJump" asp-controller="UserAndRole" class="my-4">
                        查找用户：<input type="text" class="text-black-50" name="user_name" />
                            <input type="submit" class="btn btn-warning edit-btn" value="查询" />
                        </form>
                    </div>
                    
                    <div class="card-body">
                        <table class="table table-striped">
                            <thead>
                                <tr>
                                    <th>用户名</th>
                                    <th>邮箱账号</th>
                                    <th>电话号码</th>
                                        <th></th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach (var user in Model)
                                    {
                                        <tr>
                                            <td>@user.user_name</td>
                                            <td>@user.user_account</td>
                                            <td>@user.phone</td>
                                            <td>
                                                <form asp-action="DelSumbit" asp-controller="UserAndRole" class="my-4">
                                                    <input type="hidden" name="user_account" value="@user.user_account" />
                                                <input type="submit" class="btn btn-danger delete-btn" value="删除">
                                            </form>
                                            </td>
                                            <td>
                                                <form asp-action="UpdJump" asp-controller="UserAndRole" class="my-4">
                                                    <input type="hidden" name="user_account" value="@user.user_account" />
                                                <input type="submit" class="btn btn-warning edit-btn" value="修改">
                                                </form>
                                            </td>
                                        </tr>

                                }
                            </tbody>
                        </table>
                        <!-- Bootstrap 分页组件 -->
                        <nav aria-label="Page navigation example">
                           <ul class="pagination justify-content-center">
                               <li class="page-item"><a class="page-link" href="#">上一页</a></li>
                              <li class="page-item"><a class="page-link" href="#">1</a></li>
                              <li class="page-item"><a class="page-link" href="#">下一页</a></li>
                          </ul>
                       </nav>

                    </div>
                </div>
            </div>
        </div>
    </div>

</body>
</html>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"></script>

<script>
    // 如果 TempData["Message"] 有内容，则显示一个 alert 对话框
    @if (TempData["Message"] != null)
    {
        <text>
            alert("@Html.Raw(TempData["Message"])");
        </text>
    }
</script>